#
#  Makefile to build 
#  
#
# 虚拟机里的工具链
CROSS_COMPILE 	= 
#
# Include the make variables (CC, etc...)
#
AS		= $(CROSS_COMPILE)as
LD		= $(CROSS_COMPILE)ld
CC		= $(CROSS_COMPILE)gcc
CPP		= $(CC) -E
AR		= $(CROSS_COMPILE)ar
NM		= $(CROSS_COMPILE)nm
STRIP		= $(CROSS_COMPILE)strip
OBJCOPY		= $(CROSS_COMPILE)objcopy
OBJDUMP		= $(CROSS_COMPILE)objdump
SIZE		= $(CROSS_COMPILE)size

ifeq (1,${release})
CFLAGS += -Os
else
CFLAGS += -g -DDEBUG_PRINTF
endif


#源文件
SOURCE = $(wildcard *.c src/*.c)
OBJ = $(patsubst %.c,%.o,${SOURCE})
#头文件查找路径
INCLUDES = -Iinclude
#链接库查找路径
LIBS = -lpthread
# 最终的目标文件
TARGET = easylog

${TARGET}:${OBJ}
	$(CC) $(OBJ) -o $@ $(LIBS)

%.o:%.c
	$(CC) $(CFLAGS) -c $< -o $@ $(INCLUDES)   

clean:
	rm -f $(TARGET) *.o $(OBJ)